﻿@{
    var controller = ViewContext.RouteData.Values["controller"].ToString();
    var action = ViewContext.RouteData.Values["action"].ToString();
}
<ul class="nav nav-pills flex-column" id="menu">
    <li class="nav-item"><a asp-action="Index" asp-controller="Home" class="nav-link @if (controller.Contains("Home")) { <text>active</text>}"><i class="fa fa-home"></i> 首页</a></li>

    <li class="nav-item ">
        <a class="nav-link" href="#article" role="button" data-toggle="collapse" aria-expanded="true">
            <i class="fa fa-newspaper"></i> 文章 &nbsp;<i class="fa fa-sort-down"></i>
        </a>
        <div class="collapse @if (controller.Contains("Article")) { <text>show</text>}" id="article" aria-labelledby="article">
            <a asp-action="Edit" asp-controller="Article" class="dropdown-item @if (controller.Contains("Article") && action.Contains("Edit")) { <text>active</text>}">
                创作中心
            </a>
            <a asp-action="List" asp-controller="Article" class="dropdown-item @if (controller.Contains("Article") && action.Contains("List")) { <text>active</text>}">
                文章管理
            </a>
        </div>
    </li>

    <li class="nav-item ">
        <a class="nav-link" href="#category" role="button" data-toggle="collapse" aria-expanded="true">
            <i class="fa fa-server"></i> 分类 &nbsp;<i class="fa fa-sort-down"></i>
        </a>
        <div class="collapse @if (controller.Contains("Category")) { <text>show</text>}" id="category" aria-labelledby="category">
            <a asp-action="Edit" asp-controller="Category" class="dropdown-item @if (controller.Contains("Category") && action.Contains("Edit")) { <text>active</text>}">
                新增分类
            </a>
            <a asp-action="List" asp-controller="Category" class="dropdown-item @if (controller.Contains("Category") && action.Contains("List")) { <text>active</text>}">
                分类管理
            </a>
        </div>
    </li>
    <li class="nav-item ">
        <a class="nav-link" href="#setting" role="button" data-toggle="collapse" aria-expanded="true">
            <i class="fa fa-cogs"></i> 设置 &nbsp;<i class="fa fa-sort-down"></i>
        </a>
        <div class="collapse @if (controller.Contains("Setting")) { <text>show</text>}" id="setting" aria-labelledby="setting">
            <a asp-action="Site" asp-controller="Setting" class="dropdown-item @if (controller.Contains("Setting") && action.Contains("Site")) { <text>active</text>}">
                站点信息
            </a>
            <a asp-action="NavigationList" asp-controller="Setting" class="dropdown-item @if (controller.Contains("Setting") && action.Contains("NavigationList")) { <text>active</text>}">
                导航管理
            </a>
            <a asp-action="Smtp" asp-controller="Setting" class="dropdown-item @if (controller.Contains("Setting") && action.Contains("Smtp")) { <text>active</text>}">
                Smtp 配置
            </a>
            <a asp-action="UserInfo" asp-controller="Setting" class="dropdown-item @if (controller.Contains("Setting") && action.Contains("UserInfo")) { <text>active</text>}">
                管理员信息
            </a>
            <a asp-action="ChangePwd" asp-controller="Setting" class="dropdown-item @if (controller.Contains("Setting") && action.Contains("ChangePwd")) { <text>active</text>}">
                更改密码
            </a>
        </div>
    </li>
</ul>